<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets">


<ui:composition template="/Template.xhtml">
	<ui:define name="menu">
		<table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr height="20">
				<td background="./Images/menu_hg.jpg" width="22" />
				<td background="./Images/menu_h.jpg" width="100" />
				<td background="./Images/menu_hm00.jpg" width="40" />
				<td background="./Images/menu_h.jpg" width="190" />
				<td background="./Images/menu_hd.jpg" width="21" />
				<td width="164"/>
				<td background="./Images/menu_hg.jpg" width="22" />
				<td background="./Images/menu_h.jpg" width="105" />
				<td background="./Images/menu_hm00.jpg" width="40" />
				<td background="./Images/menu_h.jpg" width="130" />
				<td background="./Images/menu_hm01.jpg" width="40" />
				<td background="./Images/h.jpg" width="105" />
				<td background="./Images/hd.jpg" width="21" />
			</tr>
			<tr height="35">
				<td background="./Images/menu_g.jpg" width="22" />
				<td bgcolor="#C7AFBD" valign="top" align="center" width="110"><a class="menu" href="./AnnoncesRecherche.jsf">Les annonces</a></td>
				<td background="./Images/menu_m00.jpg" width="40" />
				<td bgcolor="#C7AFBD" valign="top" align="center" width="140">
					<h:form>
					<h:commandLink class="menu" value="Passer une annonce" action="CompteLogin" rendered="#{!compteLogin.connecte}">
						<f:setPropertyActionListener target="#{compteLogin.page}" value="1" />
					</h:commandLink>
					<h:panelGroup rendered="#{compteLogin.connecte}">
							<h:commandLink class="menu" value="Passer une annonce" action="#{AnnoncesSession.gotoNouvellep}" rendered="#{!compteLogin.corp}" />
							<h:commandLink class="menu" value="Passer une annonce" action="#{AnnoncesSession.gotoNouvellec}" rendered="#{compteLogin.corp}" />
					</h:panelGroup>
					</h:form>
				</td>
				<td background="./Images/menu_d.jpg" width="21" />
				<td />
				<td background="./Images/menu_g.jpg" width="22" />
				<td bgcolor="#C7AFBD" valign="top" align="center" width="100">
					<h:form>
					<h:commandLink class="menu" value="Mes favoris" action="CompteLogin" rendered="#{!compteLogin.connecte}">
						<f:setPropertyActionListener target="#{compteLogin.page}" value="2" />
					</h:commandLink>
					<h:panelGroup rendered="#{compteLogin.connecte}">
						<h:commandLink class="menu" value="Mes favoris" action="AnnoncesProprietaireFavorites" rendered="#{!compteLogin.corp}" />
						<h:commandLink class="menu" value="Mes favoris" action="AnnoncesChercheurFavorites" rendered="#{compteLogin.corp}" />
					</h:panelGroup>
					</h:form>
				</td>
				<td background="./Images/menu_m00.jpg" width="40" />
				<td bgcolor="#C7AFBD" valign="top" align="center" width="100">
					<h:form>
					<h:commandLink class="menu" value="Mes annonces" action="CompteLogin" rendered="#{!compteLogin.connecte}">
						<f:setPropertyActionListener target="#{compteLogin.page}" value="3" />
					</h:commandLink>
					<h:panelGroup rendered="#{compteLogin.connecte}">
						<h:commandLink class="menu" value="Mes annonces" action="AnnoncesProprietairePerso" rendered="#{!compteLogin.corp}" />
						<h:commandLink class="menu" value="Mes annonces" action="AnnoncesChercheurPerso" rendered="#{compteLogin.corp}" />
					</h:panelGroup>
					</h:form>
				</td>
				<td background="./Images/menu_m01.jpg" width="40" />
				<td bgcolor="#F8F2DA" valign="top" align="center" width="100">
					<h:form>
					<h:commandLink class="menuselect" value="Mon panier" action="CompteLogin" rendered="#{!compteLogin.connecte}">
						<f:setPropertyActionListener target="#{compteLogin.page}" value="4" />
					</h:commandLink>
					<h:commandLink class="menuselect" value="Mon panier" action="Panier" rendered="#{compteLogin.connecte}" />
					</h:form>
				</td>
				<td background="./Images/d.jpg" width="21" />
			</tr>
			<tr height="20">
				<td background="./Images/menu_bg.jpg" width="22" />
				<td background="./Images/menu_b.jpg" />
				<td background="./Images/menu_bm00.jpg" width="40" />
				<td background="./Images/menu_b.jpg" />
				<td background="./Images/menu_mg.jpg" width="21" /> 
				<td background="./Images/h.jpg"/>
				<td background="./Images/menu_md.jpg" width="22" />
				<td background="./Images/menu_b.jpg" />
				<td background="./Images/menu_bm00.jpg" width="40" />
				<td background="./Images/menu_b.jpg" />
				<td background="./Images/menu_bm01.jpg" width="40" />
				<td bgcolor="#F8F2DA" />
				<td background="./Images/d.jpg" width="21" />
			</tr>
		</table>
	</ui:define>

	<ui:define name="page">
		<h:form>
			<h1>Liste des options sélectionnées</h1>
			<h:dataTable value="#{panierSessionBean.listeAchat}" var="setOption"
				id="TOptions" cellspacing="5" >
				<h:column>
					<f:facet name="header">Titre Annonce</f:facet>
				    #{setOption.titreAnnonce}
				  </h:column>

				<h:column>
					<f:facet name="header">Nom option</f:facet>
				    #{setOption.optionPanyante.nom}
				  </h:column>
			 <h:column>
					<f:facet name="header">Durée de vie</f:facet>
				    #{setOption.optionPanyante.dureedevie}
				  </h:column>
				<h:column>
					<f:facet name="header">Prix option</f:facet>
				    #{setOption.optionPanyante.prix}
				</h:column>		
				 	<h:column> 
					
						<h:commandLink value="Supprimer" action="#{panierSessionBean.deleteOption}">
						
						   <f:setPropertyActionListener target="#{panierSessionBean.idAnnonceASupprimee}" value="#{setOption.idAnnonce}" />
						    <f:setPropertyActionListener target="#{panierSessionBean.optionPanyanteASupprimee}" value="#{setOption.optionPanyante}" />						 
						</h:commandLink>
				 </h:column>
		
			</h:dataTable>
			<br/>
			<h:outputLabel value="Total:"/>
			<h:outputText value="#{panierSessionBean.total}"/>
			<br/>
			
			<h:commandButton value="Vider panier"
							action="#{panierSessionBean.viderPanier}" style="margin:20px"/>
			
			
			<h:commandButton value="Payement"
							action="#{panierSessionBean.testTotalPourPayement}" id="cbtP" />
			<h:messages styleClass="errorMessages"/>
			
		</h:form>
	</ui:define>
</ui:composition>
</html>